package ddz;
import java.util.*;
public class pdd2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int t = sc.nextInt();
        while(t-- > 0){
            int n = sc.nextInt();
            sc.nextLine();
            char[] ch = new char[n];
            int[] num = new int[n];
            for (int i = 0; i < n; i++) {
                String[] str = sc.nextLine().split(" ");
                ch[i] = str[0].charAt(0);
                num[i] = Integer.parseInt(str[1]);
            }
            int[] ans = new int[n];
            for (int i = 0; i < n; i++) {
                int index = i;
                int sum = 1;
                int[] used = new int[n];
                while(index >= 0 && index < n) {
                    if(used[index] == 1){
                        ans[i] = -1;
                        break;
                    }
                    used[index] = 1;
                    if (ch[index] == 'L') {
                        if (index - num[index] >= 0) {
                            index = index - num[index];
                            sum++;
                        } else {
                            ans[i] = sum;
                            break;
                        }
                    }
                    else{
                        if (index + num[index] < n) {
                            index = index + num[index];
                            sum++;
                        } else {
                            ans[i] = sum;
                            break;
                        }
                    }
                }
            }
            for (int i = 0; i < n; i++) {
                if(i != n - 1){
                    System.out.print(ans[i] + " ");
                }
                else
                    System.out.println(ans[i]);
            }
        }
    }
}
/*
1
3
L 1
L 1
R 1

1
4
R 1
L 1
L 1
R 100

 */